package com.hanson.controller;

import com.hanson.common.bean.ResultMessage;
import com.hanson.service.SpreadInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/web/spread")
public class WebSpreadController {
    @Autowired
    private SpreadInfoService spreadInfoService;

    @RequestMapping(value = "/add/{parentId}", method = RequestMethod.POST)
    public ResultMessage add(@PathVariable String parentId, @CookieValue("openId") String openId) throws Exception {
        ResultMessage resultMessage = new ResultMessage();
        spreadInfoService.addSpread(openId, parentId);
        resultMessage.setMsg("操作成功！");
        return resultMessage;
    }
}
